const $=(function(){
    const getParams=(data)=>{
        var str="";
        for(var key in data){
            str+=key+"="+data[key]+"&";
        }
        return str;
    }

    const jsonp=(settings={})=>{
        let fnName="jQuery_"+parseInt(Math.random()*10000);
        window[fnName]=settings.success;

        let newUrl=settings.url+"?"+getParams(settings.data)+settings.jsonp+"="+fnName;
        let oScript=document.createElement("script");
        oScript.setAttribute("src",newUrl);

        document.body.appendChild(oScript);
        oScript.onload=function(){
            this.remove();
        }
    }
    
    return {
        jsonp
    }
})()